class CraftrollsController < ApplicationController
  # GET /craftrolls
  # GET /craftrolls.xml
  def index
    @craftrolls = Craftroll.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @craftrolls }
    end
  end

  # GET /craftrolls/1
  # GET /craftrolls/1.xml
  def show
    @craftroll = Craftroll.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @craftroll }
    end
  end

  # GET /craftrolls/new
  # GET /craftrolls/new.xml
  def new
    @craftroll = Craftroll.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @craftroll }
    end
  end

  # GET /craftrolls/1/edit
  def edit
    @craftroll = Craftroll.find(params[:id])
  end

  # POST /craftrolls
  # POST /craftrolls.xml
  def create
    @craftroll = Craftroll.new(params[:craftroll])

    respond_to do |format|
      if @craftroll.save
        flash[:notice] = 'Craftroll was successfully created.'
        format.html { redirect_to(@craftroll) }
        format.xml  { render :xml => @craftroll, :status => :created, :location => @craftroll }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @craftroll.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /craftrolls/1
  # PUT /craftrolls/1.xml
  def update
    @craftroll = Craftroll.find(params[:id])

    respond_to do |format|
      if @craftroll.update_attributes(params[:craftroll])
        flash[:notice] = 'Craftroll was successfully updated.'
        format.html { redirect_to(@craftroll) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @craftroll.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /craftrolls/1
  # DELETE /craftrolls/1.xml
  def destroy
    @craftroll = Craftroll.find(params[:id])
    @craftroll.destroy

    respond_to do |format|
      format.html { redirect_to(craftrolls_url) }
      format.xml  { head :ok }
    end
  end
end
